require 'tk'

root = TkRoot.new{
	bd "5m"
}
#var = TkVariable.new
#var.value = 1

vars = Array.new(3) {TkVariable.new(0)}


lf_left = TkLabelFrame.new{
	text "font types"
	pack side:"left"
}

lf_right = TkLabelFrame.new{
	text "people"
	pack side:"right"
}

%w[Bold Italic Underline].each_with_index do |type,i|
	chk = TkCheckButton.new(lf_left){
		text type
		variable vars[i]
		anchor "w"
		tristatevalue 3
		grid sticky:"ew"
	}
	chk.bind("ButtonRelease"){
		puts "#{chk.cget(:text)} is #{chk.get_value}"
	}
end

grp = TkVariable.new
%w[ZhouStarStar Hopy 黄飞鸿 复仇者连萌 赵怀安 张翼德].each do |x|
	rad = TkRadioButton.new(lf_right){
		text x
		variable grp
		value x+"!"
		anchor "w"
		grid sticky:"ew"
	}
	rad.bind("ButtonRelease"){
		puts "#{rad.cget(:text)} is #{rad.get_value} grp is #{grp.value}"
	}
end

Tk.mainloop